<template>
  {{ modelValue }}
  <UniDatetimePicker
    :value="modelValue"
    :type="type"
    :clear-icon="true"
    :border="false"
    @change="onChange"
  />
</template>

<script setup lang="ts">
  import UniDatetimePicker from '@/components/Form/uni_modules/uni-datetime-picker/uni-datetime-picker.vue';
  import { computed, type PropType } from 'vue';

  defineProps({
    modelValue: {
      type: String,
      default: '',
    },
    type: {
      type: String as PropType<'date' | 'daterange' | 'datetime' | 'datetimerange'>,
      default: 'date',
    },
  });
  const emits = defineEmits(['update:modelValue']);
  function onChange(val: string) {
    emits('update:modelValue', val);
  }
</script>

<style scoped></style>
